/********************************************************************************
 * Copyright (c)2016-2020, ShenZhen WanJiaAn Technology CO.,LTD.
 * All Rights Reserved.
 *
 * File Name     : tag_generator.h
 * Author        : joki.zhu
 * Date          : 2019-10-14
 *
 * Record        :
 * 1.Date        : 2019-10-14
 *   Author      : joki.zhu
 *   Modification: Created file
 ********************************************************************************/

#ifndef __TAG_GENERATOR_H__
#define __TAG_GENERATOR_H__


#ifdef __cplusplus
#if __cplusplus
extern "C"{
#endif
#endif /* __cplusplus */

typedef enum {
    TAG_ACTION_TYPE_CREATE = 0,
    TAG_ACTION_TYPE_UPDATE,
    TAG_ACTION_TYPE_RECOVERY,
    TAG_ACTION_TYPE_DUMP,
    TAG_ACTION_TYPE_MAX,
}TAG_ACTION_TYPE_E;

typedef enum {
    TAG_SEGMENT_TYPE_ENV = 0,
    TAG_SEGMENT_TYPE_BOARDINFO,
	TAG_SEGMENT_TYPE_USER0,
	TAG_SEGMENT_TYPE_USER0_BAK,
    TAG_SEGMENT_TYPE_MAX,
}TAG_SEGMENT_TYPE_E;

typedef struct {
    TAG_SEGMENT_TYPE_E enSegmentType;
    char *tagPath;
    int maxSize;
    char *pValue;
}TAG_SEGMENT_INFO_S;


typedef struct {
    TAG_ACTION_TYPE_E enActionType;
    char *tagPath;
    char *pEnv;
    char *pBoardInfo;
    char *pUser0;
}TAG_ACTION_INFO_S;

int TagCreate(char *tagfile, char *env, char *boardinfo, char *user0);
int TagUpdate(char *tagfile, char *env, char *boardinfo, char *user0);
int TagGetValue(char *tagfile, TAG_SEGMENT_TYPE_E enType, char *pValue, int maxSize);
int TagRecovery(char *tagfile);
int TagDump(char *tagfile);

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* __cplusplus */


#endif /* __TAG_GENERATOR_H__ */
